package ma.ensao.egicom.core.dto;

import java.io.Serializable;
import java.util.ArrayList;

import ma.ensao.egicom.core.dto.CaddieLineDto;
import ma.ensao.egicom.core.dto.ProductDto;
import net.sf.oval.constraint.NotBlank;
import net.sf.oval.constraint.NotNull;

import org.scub.foundation.framework.base.dto.AbstractDto;

public class CaddieLineDto extends AbstractDto implements Serializable {

    private Long id;

    @NotNull
    @NotBlank
    private ProductDto product;

    @NotNull
    @NotBlank
    private int quantity;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public ProductDto getProduct() {
        return product;
    }

    public void setProduct(ProductDto product) {
        this.product = product;
    }

    @Override
    public boolean equals(Object obj) {
        CaddieLineDto line = (CaddieLineDto) (obj);

        System.out.println("++++++++++++++ " + line.getProduct().getId() + " " +line.getQuantity() + " +++ " + this.getProduct().getId() + " "
            + this.getQuantity());

        if ((line.getQuantity() != this.getQuantity()) || (line.getProduct().getId() != this.getProduct().getId())) {

            return false;
        }
        return true;

    }
}
